home *** CD-ROM | disk | FTP | other *** search
- ─ Area: 80x86 Assembler ──────────────────────────────────────────────────────
- Msg#: 38 Date: 01-18-93 16:00
- From: Phil Inch Network type: GT Power
- To: Edward Schlunder
- Subj: VOC file format
- ──────────────────────────────────────────────────────────────────────────────
-
- Here's the format of VOC files, as promised:
-
- BYTE(S) NORMAL CONTENTS PURPOSE/DESCRIPTION
- ---------------------------------------------------------------------------
-
- 00 - 19 "Creative Voice File", 26 Just an identification block.
- The quotes are not included,
- and the 26 is byte 26 (1Ah) which
- is an end-of-file marker. There-
- fore, if you TYPE a VOC file, you
- will just see Creative Voice File.
-
- 20 - 21 26, 00 This is a low byte, high byte
- sequence which gives the offset
- of the first block of sound data
- in the file. Currently this is
- 26 ( 00 x 256 + 26 ) which is the
- length of the header, but it's
- probably good programming practice
- to read and use this value anyway
- in case the format changes later.
-
- 22 - 23 10,1 These bytes give the version
- number of the VOC file, subnumber
- first, then main number. The
- default, as you can see, is 1.10.
-
- 24 - 25 41,17 These bytes are "check digits".
- These allow you to be absolutely
- SURE that you are working with a
- VOC file. To use them, convert
- the version number (above) and
- this number to integers. Do this
- with the formula below, where for
- convention the above bytes have
- been listed as byte1, byte2.
-
- (byte2*256)+byte1
-
- Therefore, for the default values
- we get the following integers:
-
- (1 x 256)+10 = 266
- (17 x 256)+41 = 4393
-
- When you add the two results, you
- get 4659. If you do these calcs
- and get 4659, then you can be
- almost certain you're working with
- a VOC file.
-
- OK, that takes care of the header information. I hope you realise that I'll
- never get a registration for VOCHDR now! Oh well <sigh> perhaps people will
- buy my games!
-
- Having gotten to byte 26, we now start encountering data blocks. There
- are eight types in all, conveniently numbered 0 - 7. For each block, the
- first byte will always tell you the type.
-
- For notational convenience, bx means byte x, eg b5 means byte 5.
-
- BLOCK 0 - THE "END BLOCK"
-
- Structure: Byte 1: '0' to denote "end block" type
-
- This block is located at the END of a VOC file. When a VOC player
- encounters a block 0, it should stop playing the VOC file.
-
-
- BLOCK 1 - THE "DATA BLOCK"
-
- Structure: Byte 1: '1' to denote "data block" type
-
- 2: \
- 3: | These bytes give the length:
- 4: / b2 + (b3*256) + (b4*65536)
-
- 5: Sampling rate: Calculated as 1000000 / (256-b5)
-
- 6: Pack type byte:
- 0 = data is not packed
- 1 = data is packed to four bits
- 2 = data is packed to 2 bits
- 3 = data is packed to 1 bit
-
- 7: Actual sample data starts here
-
-
- BLOCK 2 - THE "MORE DATA BLOCK"
-
- Structure: Byte 1: '2' to denote "more data block" type
-
- 2: \
- 3: | These bytes give the length:
- 4: / b2 + (b3*256) + (b4*65536)
-
- 5: Actual sample data starts here
-
- The point of this is simple: If you have a sample that you want to chop
- up into smaller portions (the maximum block length in a VOC file is
- 16,842,751 bytes but who's counting?), then define a "more data" block.
- This "carries over" the previously found sampling rate and pack type byte,
- so a "data block" should have been encountered earlier somewhere along
- the line.
-
-
- BLOCK 3 - THE "SILENCE" BLOCK
-
- Structure: Byte 1: '3' to denote "silence block" type
-
- 2: \
- 3: | These bytes give the length:
- 4: / b2 + (b3*256) + (b4*65536)
-
- (Note that this value is usually 3 for a
- silence block.)
-
- 5: Duration ( b5+(b6*255) ). This gives the equivalent
- 6: number of bytes to "play" during the silence.
-
- 7: Sampling rate: Calculated as 1000000 / (256-b5)
-
- A silence block is used for long periods of silence. When long silences
- are required, it's more efficient in size terms to insert one of these
- blocks, as seven bytes can then represent up to 65,536.
-
-
- BLOCK 4 - THE "MARKER BLOCK"
-
- Structure: Byte 1: '4' to denote "marker block" type
-
- 2: \
- 3: | The length of the block, as usual
- 4: /
-
- 5: Marker value, as low-high (ie b5 + (b6*255) )
- 6:
-
- The marker block is read by CT-VOICE.DRV. When a marker block is
- encountered, the value in the marker value bytes (5 and 6) is copied into
- the status word specified when CT-VOICE was initialized.
-
- This allows your program to judge where in the sample you currently are,
- thus allowing for progress counters and the like. It's also useful if
- you're trying to synchronize other processes to the playing of the sound.
-
- For example, by using appropriate marker blocks, you could send signals
- to your software to move the lips of a person on-screen in time with the
- speech in the VOC. However, this does take some doing and a VERY good
- VOC editor!
-
-
- BLOCK 5 - THE "MESSAGE BLOCK"
-
- Structure: Byte 1: '5' to denote "message block" type
-
- 2: \
- 3: | The length of the block, as usual
- 4: /
-
- 5 - ?: Message, as ASCII text.
-
- ?: 0, to denote end of text
-
- The message block simply allows you to embed text into a VOC file.
- Presumably you could use this to detect when other people have pinched
- your VOC files for their own applications.
-
-
- BLOCK 6 - THE "REPEAT BLOCK"
-
- Structure: Byte 1: '6' to denote "repeat block" type
-
- 2: \
- 3: | The length of the block, as usual
- 4: /
-
- 5: Number of times that data should be repeated
- 6: Total = 1 + b5 + (b6*255)
-
- Every "playable" data block between a block 6 and a block 7 will be repeated
- the number of times specified in b5 and b6. Note that you add one to this
- value - the data blocks are ALWAYS played at least once. However, if b5
- and b6 are zero, then you really don't need a repeat block, do you!
-
- I'm told that you cannot "nest" repeat blocks, but I've never tried it.
- This limitation would only apply to CT-VOICE.DRV I would have thought, but
- it depends how good other VOC players are.
-
-
- BLOCK 7 - THE "END REPEAT BLOCK"
-
- Structure: Byte 1: '7' to denote "end repeat block" type
-
- 2: \
- 3: | The length of the block, as usual
- 4: /
-
- This, as explained, marks the end of the block of blocks (!) that you wish
- to repeat. Note that the "length" is always zero, so I don't know why
- the length bytes are required at all.
-
- ------------------------------------------------------------------------------
-
- WELL, that's it! Phew, what a lot of typing. I hope you lot are all
- grateful!
-
- Now I have a favour to ask; does ANYONE have the technical specs for
- programming the SB (and SBPRO)? I mean the low-level stuff, not how to access
- CT-VOICE and SBFMDRV (which I already know). If you do, get in touch as I
- really need this info.
-
- I faxed Creative Labs with this request but so far, no reply. Admittedly it
- has only been four days, maybe they are sending a reply snail-mail. Who knows.
- Ah well.
-
- Regards
- Phil
-
- Route: 302/0m20 81/1 */* 32/1tu8 32/3
- .ORIGIN: 302/000 - The Poet's Dilemma - Sydney/Oz - +61-2-8731642/1643
-
-
- My thanks go to Phil Inch in Australia for taking the time to compose
- this great piece of work. It must have taken many hours of his time to
- search his books, and then understand his books to come up with this.
-
- He did this all for free and now he won't get registrations for his
- VOCHDR program. Please, if you find his program, register it if you
- like it. Please, don't use this information against Phil, create a
- program unlike Phil's and register Phil's program.
-
- - Edward T. Schlunder
-